<template>
	<view class="avatar-box" @click="showUser(item)">
		<u-avatar v-if="item.checkStatus == '0'" class="avatar" :size="90"></u-avatar>
		<u-avatar v-else :src="item.avatar" class="avatar" :size="90"></u-avatar>
		<view class="nickname" v-if="item.checkStatus == '0'">查看匿名者</view>
		<view class="nickname ellipsis" v-else>{{item.nickName}}</view>
	</view>
</template>
<script>
	export default {
		name:'',
		props:{
			item: {
				// 数据
				type: Object,
				default () {
					return {}
				}
			},
		},
		data() {
			return {
				loading: false,
			}
		},
		methods:{
			showUser(e) {
				if(e.checkStatus == '0'){
					this.$emit('preAd', (res)=> {
					   if(res){
						   this.$emit('ok',e);
					   }
					})
				}else{
					this.userCenter(e);
				}
			},
			userCenter(e) {
				this.$u.route({
					url: 'packgeMine/pages/center/index',
					params: {
						userId: e.sendUserId,
					}
				});
			},
		}
	}
</script>

<style scoped lang="scss">
	.avatar-box {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		width: 140rpx;
	}
	.avatar {
		//margin-right: 30rpx;
	}
	.nickname {
		margin-top: 5px;
		font-size: 22rpx;
		color: #5aaeb0;
	}
	.ellipsis {
		max-width: 110rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
</style>